﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Windows.Forms;

namespace TLCApp.pulic
{
    

    /// <summary>
    /// WriteLog 的摘要说明。
    /// </summary>
    public class WriteLog
    {
        public WriteLog()
        {
            //
            // TODO: 在此处添加构造函数逻辑

            //	

        }

        public static void WriteLoginf(string strContent)
        {			//log文件不存在，新建一份log文件
            string strFileName = Application.StartupPath + "\\log.txt";
            if (File.Exists(strFileName) == false)
            {
                FileStream fs = new FileStream(strFileName, FileMode.Create);
                fs.Close();
            }
            StreamWriter sw = new StreamWriter(strFileName, true);//true是指以追加的方式打开指定文件
            sw.WriteLine("\r\n" + "*----------------------"+DateTime.Now.ToString()+"-------------*");
            sw.WriteLine("\r\n" + strContent);
            sw.WriteLine("\r\n" + "*--------------------------------------------------------*");
            sw.Flush();
            sw.Close();
        }
    }
}
